package com.example.testspringes.threadtest;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Description: //TODO
 * @ProjectName: testspringes
 * @Package: com.example.testspringes.threadtest
 * @Author: FX
 * @CreateDate: 2019/3/29 17:06
 * @Version: 1.0
 * Copyright: Copyright (c) 2019
 */
public class Task implements Runnable {
    public static AtomicInteger atomicInteger = new AtomicInteger(0);
    @Override
    public void run() {
        while (atomicInteger.get()<100){
            atomicInteger.getAndAdd(1);
            System.out.println(Thread.currentThread().getName()+"--"+atomicInteger.get());
            try {
                Thread.sleep(100);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
